package com.examples.cmw.android_study_demos;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {
    private static final String TAG = "MainActivity";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.btn_simple_components).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Class activityClass = null;
        switch (v.getId()) {
            case R.id.btn_simple_components: // 简单组件
                activityClass = SimpleComponetActivity.class;
                break;
            case R.id.btn_main_test2: // 测试菜单
                activityClass = SimpleComponetActivity.class;
                break;
            case R.id.btn_main_test3: // 测试进度条
                activityClass = ProgressActivity.class;
                break;
                default:
                    Log.e(TAG, String.format("找不到ID:%d对应的Activiry", v.getId()));
        }
        Intent intent = new Intent(MainActivity.this, activityClass);
        startActivity(intent);
    }
}
